package org.wsff.tools.api.gateway.core;

import java.io.Serializable;

import org.wsff.tools.api.gateway.error.GatewayException;

/**
 * 网关，路由业务请求到对应的服务
 *
 * @author ryan
 * @version Id: Gateway.java, v 0.1 2022-01-18 17:11 ryan Exp $$
 */
public interface Gateway<Request extends Serializable, Response extends Serializable> {

    /**
     * API服务入口，根据服务方法，调度具体的业务接口执行业务逻辑
     *
     * @param request API request
     * @param name  proxy name
     * @return API response
     * @throws GatewayException 网关异常
     */
    Response invoke(Request request, String name) throws GatewayException;
}
